#ifndef _NC_M1CARD_H_
#define _NC_M1CARD_H_
#include "../../includes.h"

//====================>>Mifare One卡命令
#define DEF_MiOne_KEYA 		0x60			//A校验密码
#define DEF_MiOne_KEYB 		0x61			//B校验密码
#define DEF_MiOne_READ   	0x30			//块读
#define DEF_MiOne_WRITE  	0xA0			//块写
#define DEF_MiOne_ADD		0xC1			//加值
#define DEF_MiOne_SUB		0xC0			//减值
#define DEF_MiOne_RESTORE	0xC2			//传输
#define DEF_MiOne_TRANSFER	0xB0			//加/减/传输　执行  (不需要单独执行)

#define 	DEF_SysCard_Debug  errmsg("Er F=%s N=%d\r\n",__FILE__,__LINE__);

extern void errmsg( const char *format, ... );
extern unsigned int HexToStr(unsigned char *in, unsigned int insize, char *out);
extern unsigned int StrToHex(char *in, unsigned int insize, unsigned char *out);


extern U32 ICC_MiOne_LoadKey( U08 *keybuf );				//MifareOne卡加载密码	  	(不需要单独调用)
extern U32 ICC_MiOne_CheckKey( U08 AuthMode, U08 *Snr, U08 Block );
															//MifareOne卡校验密码		(不需要单独调用)
extern U32 ICC_MiOne_BlkRead(  U08 block,U08 cmd,U08 *key, U08 *Snr, U08 *r_buf );		//MifareOne卡块读	  		(不需要单独调用)
extern U32 ICC_MiOne_BlkWrite( U08 block,U08 cmd,U08 *key, U08 *Snr, U08 *w_buf );		//MifareOne卡块写		 	(不需要单独调用)

extern U32 ICC_MiOne_Value( U08 cmd, U08 block, U08 *bufw, U08 tranblock );
															//MifareOne卡加/减/传输操作	(不需要单独调用)

//多增加的一个函数，用来获取M1卡的物理卡号
extern U32 ICC_MiOne_GetPhySn( U08 *rbuf );
#endif

